import { get } from '../utils/request'
import { HOME_API } from '../constants/api'

/**
 * 首页API服务
 */

/**
 * 获取首页轮播图
 * @returns Promise
 */
export const getBanners = () => {
  return get(HOME_API.BANNER)
}

/**
 * 获取产品分类
 * @returns Promise
 */
export const getCategories = () => {
  return get(HOME_API.CATEGORY)
}

/**
 * 获取商品列表
 * @param params 请求参数
 * @returns Promise
 */
export const getProducts = (params = {}) => {
  return get(HOME_API.PRODUCT_LIST, params)
}

/**
 * 获取热门商品
 * @param params 请求参数
 * @returns Promise
 */
export const getHotProducts = (params = {}) => {
  return get(HOME_API.HOT_PRODUCTS, params)
}

/**
 * 获取推荐商品
 * @param params 请求参数
 * @returns Promise
 */
export const getRecommendProducts = (params = {}) => {
  return get(HOME_API.RECOMMEND_PRODUCTS, params)
}

export default {
  getBanners,
  getCategories,
  getProducts,
  getHotProducts,
  getRecommendProducts
} 